Notes
-----
-Tempest in a Java Pot should work on most MacOS X, Windows, Linux, and Solaris computers which have a Java 7 or newer runtime installed.

-In order to run without any stuttering the system needs to have OpenGL acceleration working well and a sufficiently fast processor. The processor speed needed to run without stuttering can vary greatly depending on what resolution and refresh rate is being used but any processor running at over 1 GHz should be able to run at at least 640 x 480 @ 60 Hz sufficiently. A 2.4 GHz Core 2 Duo runs well at 1024 x 768 @ 60 Hz.

-You will probably need one of the old, bulky CRT monitors in order to generate a signal that can be picked up by a radio, but some LCD monitors may work too.

-Tempest in a Java Pot should be able to play most MP3s and most 16 bit, stereo WAV or AIFF files. Some other less common file types may work as well and you can also possibly install additional Service Provider Interfaces (SPI) to add support for more file formats. Also it should be possible to support mono or 8 bit WAV or AIFF files with some tweaks to the code if anyone is interested.

-JOGL 2.1.5 (and probably older versions) seems to have at least one bug which causes the viewport to be set wrong when going full screen after changing the monitor mode on OS X (and possibly other platforms). JOGL 2.2.0 seems to work OK.

-Tempest in a Java Pot is licensed under the Simplified BSD license but also includes binaries from the JOGL and MP3SPI projects for OpenGL and MP3 support. See the LICENSE.txt file for more information.


To run from a JAR file
----------------------
On most properly configured operating systems you can just double click the "Tempest in a Java Pot v0.5.jar" file to run it. Alternatively from a command line you can run:
java -jar "Tempest in a Java Pot v0.5.jar"


How to use
----------
Once you get Tempest in a Java Pot running you will be greeted with a settings dialog.

From the settings dialog either enter the path to a supported audio file type (MP3s or 16 bit, stereo WAV or AIFF files) in the "Audio file path" text field or click the "Browse..." button to select one. Once a valid audio file is entered you may then either click the "Run in Window" or "Run Full Screen" button to play and transmit the audio file using the default settings. Note that running full screen will generate a better signal for a radio to pick up since more of the screen can then be used for generating the image/signal. The other settings are explained below:

-AM frequency to transmit on
This is used to select the AM frequency in kHz which should be used when generating the transmission image. Note that after some further experimentation this setting seems to have little effect on how well an AM radio will pick up the audio signal, see the About Tempest in a Java Pot section above for more about this. 

-Audio transmission amplification
This is used to amplify or quiet the audio that is used to generate the transmission frame by specifying how loud the audio should be as a percentage of its normal value. Setting this to values over 100% can increase the distance over which the audio signal can be picked up but can also cause clipping to occur. 

-Algorithm to use for generating transmission frame
Selects which algorithm is used for generating the transmission frames. The "Sine wave AM carrier x Audio waveform plus Offset" option should generate the most correct AM signal but in practice the "Audio waveform" algorithm seems to work best for causing an AM radio to pick up the audio signal, see the About Tempest in a Java Pot section above for more about this. 

-Resolution and refresh rate to use
Selects what resolution and refresh rate should be used when displaying the transmission frames. Higher resolutions and refresh rates will require greater processor usage which may result in stuttering. Lower resolutions and refresh rates also generally will result in slightly better audio quality because they typically result in the horizontal blanking interval on the monitor being relatively shorter than the interval in which the screen is being drawn. 

While transmitting/playing an audio file you can also use the following keys to perform the following actions:

-Escape and Q Keys
Stop transmitting/playing the audio file and return to the settings dialog box. 

-Left and Right Arrow Keys
Change the AM frequency to transmit on. 

-Up and Down Arrow Keys
Change the audio transmission amplification. 

-< > , and . Keys
Change the algorithm to use for generating transmission frames. 

-T Key
Toggle between transmitting/playing a tone or the audio file. 

-1 2 3 4 5 6 7 8 9 and (1)0 Keys
When transmitting/playing a tone, set the tone frequency to the value of the key x 100 Hz.


To compile
----------
javac -classpath "JOGL/gluegen-rt.jar:JOGL/jogl-all.jar" Tempest_in_a_Java_Pot.java Tempest_in_a_Java_Pot_Window.java Audio_Processing_Thread.java


To run from built source code
-----------------------------
java -classpath "JOGL/gluegen-rt.jar:JOGL/jogl-all.jar:MpegAudioSPI1.9.5/mp3spi1.9.5.jar:MpegAudioSPI1.9.5/lib/jl1.0.1.jar:MpegAudioSPI1.9.5/lib/tritonus_share.jar:." Tempest_in_a_Java_Pot


To build a JAR file (on most *nix systems using Bash)
-----------------------------------------------------
Create a directory called "JAR Contents"
cp *.class "JAR Contents/"
unzip JOGL/jogl-all.jar -x META-INF/* -d "JAR Contents/"
unzip JOGL/gluegen-rt.jar -x META-INF/* -d "JAR Contents/"
unzip MpegAudioSPI1.9.5/mp3spi1.9.5.jar -d "JAR Contents/"
unzip MpegAudioSPI1.9.5/lib/jl1.0.1.jar -x META-INF/* -d "JAR Contents/"
unzip MpegAudioSPI1.9.5/lib/tritonus_share.jar -x META-INF/* -d "JAR Contents/"
cp Manifest "JAR Contents/META-INF/MANIFEST.MF"

for file in JOGL/jogl-all-natives-*.jar
do
	OS_And_Arch=${file##*/}
	OS_And_Arch=${OS_And_Arch/jogl-all-natives-}
	OS_And_Arch=${OS_And_Arch%.jar}
	mkdir -p "JAR Contents/natives/$OS_And_Arch"
	unzip $file *.jnilib *.dll *.so -d "JAR Contents/natives/$OS_And_Arch/"
done

for file in JOGL/gluegen-rt-natives-*.jar
do
	OS_And_Arch=${file##*/}
	OS_And_Arch=${OS_And_Arch/gluegen-rt-natives-}
	OS_And_Arch=${OS_And_Arch%.jar}
	mkdir -p "JAR Contents/natives/$OS_And_Arch"
	unzip $file *.jnilib *.dll *.so -d "JAR Contents/natives/$OS_And_Arch/"
done

cd "JAR Contents"
jar cvfm "../Tempest in a Java Pot.jar" META-INF/MANIFEST.MF *